package com.net.oil.luckPan.presenter;

import com.net.oil.base.BasePresenter;
import com.net.oil.http.custom.ApiException;
import com.net.oil.luckPan.bean.LotteryBean;
import com.net.oil.luckPan.bean.LuckPanBean;
import com.net.oil.luckPan.contract.LuckPanContract;
import com.net.oil.luckPan.model.LuckPanModel;

/**
 * 作者：lch
 * 时间：2018/10/14 0014:下午 19:44
 * 邮箱：245850413@qq.com
 * 说明：
 */

public class LuckPanPresenter extends BasePresenter<LuckPanContract.View> implements LuckPanContract.Presenter {

    private LuckPanContract.View view;
    private LuckPanContract.Model model;

    public LuckPanPresenter(LuckPanContract.View view) {
        this.view = view;
        model = new LuckPanModel(this);
    }

    @Override
    protected void unSubscribe() {
        model.unSubscribe();
    }

    @Override
    public void initLuckPan(int actionId) {
        model.initLuckPan(actionId);
    }

    @Override
    public void lottery(int actionId) {
        model.lottery(actionId);
    }

    @Override
    public void initLuckPanSuccess(LuckPanBean luckPanBean) {
        view.initLuckPanSuccess(luckPanBean);
    }

    @Override
    public void initLuckPanFailed() {
        view.initLuckPanFailed();
    }

    @Override
    public void lotterySuccess(LotteryBean lotteryBean) {
        view.lotterySuccess(lotteryBean);
    }

    @Override
    public void lotteryFailed(ApiException e) {
        view.lotteryFailed(e);
    }
}
